package com.etc.singleton;


/**
 * 单例模式3 ->懒汉
 */
public class Singleton4 {

	private static Singleton4 instance;
	private Singleton4() {}

	/**
	 * 支持线程同步,但是效率不高
	 * @return
	 */
	public static synchronized Singleton4 getInstance() {
		if (instance == null) {
			instance = new Singleton4();
		}
		return instance;
	}
}
